package leetcode.code1524;

public class Solution2 {

	int mod = (int) 1e9 + 7;

	public int numOfSubarrays(int[] arr) {
		int o = 0, e = 0;
		long ans = 0;
		for (int i = 0; i < arr.length; i++) {
			if ((arr[i] & 1) == 1) {
				int ce = e;
				e = o;
				o = ce + 1;
			} else {
				e++;
			}
			ans += o;
			ans %= mod;
		}
		return (int) ans;
	}
}
